package com.mb.mp.controller;

import com.mb.common.controller.BaseController;
import com.mb.mp.domain.MpCompanyInfoDO;
import com.mb.mp.service.ICompanyInfoService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

/**
 * @author 王源
 * @program mp-parent
 * @description 品牌库未完成
 * @date 2018-09-04 16:44
 **/
@Controller
@RequestMapping("/mp/company")
public class CompanyController extends BaseController{
    private static final Logger logger = LoggerFactory.getLogger(CompanyController.class);

    @Autowired
    private ICompanyInfoService companyInfoService;

    @GetMapping("/info")
    String infoPage(){
        return "/mp/company_info";
    }

    @ResponseBody
    @GetMapping("/getInfo")
    public MpCompanyInfoDO getInfo(@RequestParam Map<String, Object> params){
        MpCompanyInfoDO companyInfo = companyInfoService.getInfo();
        return companyInfo;
    }

    @ResponseBody
    @PostMapping("/save")
    public MpCompanyInfoDO save(MpCompanyInfoDO companyInfo, HttpServletRequest request){
        companyInfoService.save(companyInfo);
        companyInfo = companyInfoService.getInfo();
        return companyInfo;
    }



}
